#include "lasercamerafetchpointinsview.h"
#include "ui_lasercamerafetchpointinsview.h"

LaserCameraFetchPointInsView::LaserCameraFetchPointInsView(int styleIdIn,QWidget *parent) :
    QWidget(parent),
    ui(new Ui::LaserCameraFetchPointInsView)
{
    ui->setupUi(this);
    setGeometry(5,50,451,544);
    initialDisplayStyle(styleIdIn);
}

LaserCameraFetchPointInsView::~LaserCameraFetchPointInsView()
{
    delete ui;
}


void LaserCameraFetchPointInsView::initialDisplayStyle(int styleId)
{
    switch (styleId) {
    case 1:
        ui->save_Btn->setGeometry(360,350,70,40);
        break;
    default:
        break;
    }
}


void LaserCameraFetchPointInsView::getInput(LaserCameraPointFetchInstruction &instructionParaOut)
{
    instructionParaOut.comment=ui->note_lineEdit->text();


    instructionParaOut.prRegisterIndex=ui->lineEdit_prIndex->text().toInt();

}


void LaserCameraFetchPointInsView::updateView()
{

    ui->lineEdit_prIndex->setText(QString::number(instructionPara.prRegisterIndex));
    ui->note_lineEdit->setText(instructionPara.comment);
}

void LaserCameraFetchPointInsView::changeLanguage(int language)
{
   //TODO
}


void LaserCameraFetchPointInsView::finishEditInstruction(LaserCameraPointFetchInstruction instructionParaIn,QString &instructionStrOut)
{
    instructionStrOut.clear();
    instructionStrOut="RECORD_LASERCAMERA ";

    instructionStrOut+="PR[";
    instructionStrOut+=QString::number(instructionParaIn.prRegisterIndex)+"]";

    instructionStrOut+=";//"+instructionParaIn.comment;

}



void LaserCameraFetchPointInsView::on_clearNote_Btn_clicked()
{
    ui->note_lineEdit->setText("");
}

void LaserCameraFetchPointInsView::on_save_Btn_clicked()
{
    getInput(instructionPara);
    finishEditInstruction(instructionPara,instructionStr);
//    emit finishEditInstructionSignal();
    emit saveInstructionSignal(instructionStr);
}

